package com.yilin.medical.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.yilin.medical.R;
import com.yilin.medical.model.WoTiJiaoZhuanZhenBean;

public class WoTiJiaoZhuanZhenAdapter extends BaseAdapter{
	private List<WoTiJiaoZhuanZhenBean> list = null;
	private Context mContext;
	private boolean showjujue;
	public WoTiJiaoZhuanZhenAdapter(Context mContext, List<WoTiJiaoZhuanZhenBean> list,boolean showjujue) {
		this.mContext = mContext;
		this.list = list;
		this.showjujue = showjujue;
	}


	public int getCount() {
		return this.list.size();
	}

	public Object getItem(int position) {
		return list.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(final int position, View view, ViewGroup arg2) {
		ViewHolder holder = null;
		final WoTiJiaoZhuanZhenBean mContent = list.get(position);
		if (view == null) {
			holder = new ViewHolder();
			view = LayoutInflater.from(mContext).inflate(
					R.layout.listitem_wotijiaozhuanzhen, null);
			holder.tv_name = (TextView) view.findViewById(R.id.tv_title);
			holder.tv_descibe = (TextView) view.findViewById(R.id.tv_descibe);
			holder.tv_zhuanjianame = (TextView) view.findViewById(R.id.tv_zhuanjianame);
			holder.tv_date = (TextView) view.findViewById(R.id.tv_date);
			holder.tv_jieshou = (TextView) view.findViewById(R.id.tv_jieshou);
			view.setTag(holder);
		} else {
			holder = (ViewHolder) view.getTag();
		}
		if (showjujue) {
			holder.tv_jieshou.setVisibility(View.VISIBLE);
		}else {
			holder.tv_jieshou.setVisibility(View.GONE);
		}


//		holder.tv_title.setText(this.list.get(position).getName());

		return view;

	}

	final static class ViewHolder {
		TextView  tv_name, tv_descibe,tv_zhuanjianame,tv_date,tv_jieshou;
	}



}